import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';  //加，此时不是HttpClientModule

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'my-app';
  lists:Array<number> = [1,2,3];
  constructor (public http:HttpClient){}			//此时不是HttpClientModule
  handleClick():void{
    // console.log("click");
    console.log(this.title);
    this.title = "change"
  }

  /* 组件初始化的时候触发 */
  ngOnInit(){
    // console.log("OnInit");
    var url:string = "http://localhost:8000/top250";//获取http请求
    this.http.get(url).subscribe(res=>{
      console.log(res);
      
    })
  }
}
